package org.misalen.web.database.model.mysql.sys;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.misalen.annotations.ModelComment;
import org.misalen.web.database.model.mysql.BaseSqlModel;

/**
 * 字典
 * 
 * @author guochao
 *
 */
@Entity
@Table(name = "SysWordbook")
@DynamicInsert(true)
@DynamicUpdate(true)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SysWordbook extends BaseSqlModel {

	@ModelComment("用户名")
	@Column(name = "wordbookName", length = 50, nullable = false)
	private String wordbookName;

	@ModelComment("昵称")
	@Column(name = "wordbookCode", length = 50, unique = true, nullable = false)
	private String wordbookCode;

	@OneToMany(targetEntity = SysWordbookItem.class, cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	@JoinColumn(name = "wordbookId", updatable = false)
	@ModelComment("与字典数据的关系")
	private Set<SysWordbookItem> sysWordbookItems;

	public String getWordbookName() {
		return wordbookName;
	}

	public void setWordbookName(String wordbookName) {
		this.wordbookName = wordbookName;
	}

	public String getWordbookCode() {
		return wordbookCode;
	}

	public void setWordbookCode(String wordbookCode) {
		this.wordbookCode = wordbookCode;
	}

	public Set<SysWordbookItem> getSysWordbookItems() {
		return sysWordbookItems;
	}

	public void setSysWordbookItems(Set<SysWordbookItem> sysWordbookItems) {
		this.sysWordbookItems = sysWordbookItems;
	}

}
